package com.example.hospitalmanagement.activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.hospitalmanagement.R
import com.example.hospitalmanagement.adapter.RegisterActivityAdapter
import com.example.hospitalmanagement.bean.DiagnosisAndTreatmentItem

/**
 * 门诊支付Activity
 *
 * 位置:诊疗服务-门诊支付
 */
class OutpatientPaymentActivity : AppCompatActivity() {
    lateinit var adapter:RegisterActivityAdapter
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_outpatient_payment)
        initView()
    }

    /**
     * 负责页面列表显示以及Activity的跳转(门诊缴费+门诊缴费记录)
     */
    private fun initView() {
        val paymentItems: RecyclerView = findViewById(R.id.outpatient_payment_items)
        paymentItems.layoutManager = GridLayoutManager(this, 2)
        val dataList: MutableList<DiagnosisAndTreatmentItem> = mutableListOf(
            DiagnosisAndTreatmentItem(
                R.mipmap.price_announcement,
                "门诊缴费"
            ), DiagnosisAndTreatmentItem(
                R.mipmap.price_announcement,
                "门诊缴费记录"
            )
        )
        adapter = RegisterActivityAdapter(this)
        adapter.dataList = dataList
        paymentItems.adapter = adapter

        adapter.setListener {
            when(it){
                0->{}
                1->{
                   startActivity(Intent(this@OutpatientPaymentActivity,OutpatientPaymentRecordActivity::class.java))
                }
            }
        }
    }
}